<%@ page import="hotsaucerecipes.Recipe" %>



<div class="fieldcontain ${hasErrors(bean: recipeInstance, field: 'title', 'error')} required">
    <label for="title">
        <g:message code="recipe.title.label" default="Title"/>
        <span class="required-indicator">*</span>
    </label>
    <g:textField name="title" maxlength="100" required="" value="${recipeInstance?.title}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: recipeInstance, field: 'ingredients', 'error')} required">
    <label for="ingredients">
        <g:message code="recipe.ingredients.label" default="Ingredients"/>
        <span class="required-indicator">*</span>
    </label>
    <g:textField name="ingredients" required="" value="${recipeInstance?.ingredients}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: recipeInstance, field: 'instructions', 'error')} required">
    <label for="instructions">
        <g:message code="recipe.instructions.label" default="Instructions"/>
        <span class="required-indicator">*</span>
    </label>
    <g:textArea name="instructions" cols="40" rows="5" required="" value="${recipeInstance?.instructions}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: recipeInstance, field: 'reviews', 'error')} ">
    <label for="reviews">
        <g:message code="recipe.reviews.label" default="Reviews"/>

    </label>

    <ul class="one-to-many">
        <g:each in="${recipeInstance?.reviews ?}" var="r">
            <li><g:link controller="review" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></li>
        </g:each>
        <li class="add">
            <g:link controller="review" action="create"
                    params="['recipe.id': recipeInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'review.label', default: 'Review')])}</g:link>
        </li>
    </ul>

</div>

